#-------------------------------------------------------------------------------
#   Compiler
#-------------------------------------------------------------------------------
cc=g++
cco=$(cc) $(CFLAGS) $(GENERAL_INCLUDES) $< -o $@ 
cclk=$(cc) $(LFLAGS) $(LINKFLAGS) -o $@
#-------------------------------------------------------------------------------
#   Flags
#-------------------------------------------------------------------------------
DEBUG= -g
CFLAGS = -Wall -c $(DEBUG) -std=c++0x 
#-fPIC -nostartfiles
LFLAGS = -Wall $(DEBUG) -std=c++0x
LINKFLAGS= -shared -nostartfiles

#-------------------------------------------------------------------------------
#   Directories
#-------------------------------------------------------------------------------
PROJECT_DIR=$(PWD)/
YAML_DIR=$(PROJECT_DIR)yaml-cpp/
YAML_SRC=$(YAML_DIR)src/
EXE=$(EXE_DIR)/
OBJ=$(OBJ_DIR)/

#-------------------------------------------------------------------------------
#   Includes
#-------------------------------------------------------------------------------
USR_INCLUDE=/usr/include
GCC_INCLUDE=/usr/lib/gcc
LOCAL_INCLUDE=/usr/local/include
YAML_INCLUDE=$(YAML_DIR)include

GENERAL_INCLUDES=-I $(USR_INCLUDE) -I $(GCC_INCLUDE) -I $(LOCAL_INCLUDE) \
				-I $(YAML_INCLUDE)

#-------------------------------------------------------------------------------
#   Todo
#-------------------------------------------------------------------------------

#LIBRARY_NAME=$(EXE)libyaml.so

#CXX_SRCS=$(wildcard $(YAML_SRC)*.cpp)
CXX_SRCS=aliasmanager.cpp\
	binary.cpp \
	conversion.cpp \
	directives.cpp \
	emitfromevents.cpp \
	emitter.cpp \
	emitterstate.cpp\
	emitterutils.cpp\
	exp.cpp\
	iterator.cpp\
	nodebuilder.cpp\
	node.cpp\
	nodeownership.cpp\
	null.cpp\
	ostream.cpp\
	parser.cpp\
	regex.cpp\
	scanner.cpp\
	scanscalar.cpp\
	scantag.cpp\
	scantoken.cpp\
	simplekey.cpp\
	singledocparser.cpp\
	stream.cpp \
	tag.cpp  

CXX_OBJS=$(CXX_SRCS:%.cpp=$(OBJ)%.o)

#all-local: 	
	#@echo 'sssss-> $(CXX_OBJS)'

#all: 	$(LIBRARY_NAME)
#	@echo 'libyaml -> Actualizado!'
	
all: $(CXX_OBJS)
	@echo 'objetos actualizados!'
#-------------------------------------------------------------------------------
#   Shared library
#-------------------------------------------------------------------------------

#$(LIBRARY_NAME): $(CXX_OBJS) 
#	@$S
#	$(cclk) $(GENERAL_INCLUDES) $(CXX_OBJS) -o $(EXE)libyaml.so

#-------------------------------------------------------------------------------
#   Objetos
#-------------------------------------------------------------------------------
$(OBJ)%.o: $(YAML_SRC)%.cpp
	$(cco)
#	gcc $(CFLAGS) $(GENERAL_INCLUDES) $< -o $@

#-------------------------------------------------------------------------------
clean :
	@$S
	rm -rf $(CXX_OBJS)
#$(LIBRARY_NAME) 
	@echo 'Cleaned objs !'

#-------------------------------------------------------------------------------
